function removeFromArray(arr, v) {
   for(var i = 0; i < arr.length; i++) {
      if(v == arr[i]) {
         arr.splice(i, 1);
      }
   }
}

SimpleMap = function() {
   this.keys = new Array();
   this.values = new Object();
}

SimpleMap.prototype.put = function(k, v) {
   if(this.values[k] == null) {
      this.keys.push(k);
   }

   this.values[k] = v;
}

SimpleMap.prototype.get = function(k) {
   return this.values[k];
}

SimpleMap.prototype.remove = function(k) {
   removeFromArray(this.keys, k);
   this.values[k] = null;
}

SimpleMap.prototype.size = function() {
   return this.keys.length;
}

SimpleMap.prototype.isEmpty = function() {
   return this.keys.length == 0;
}

SimpleMap.prototype.clear = function() {
   this.keys.splice(0, this.keys.length);
   this.values = null;
   this.values = new Object();
}

SimpleMap.prototype.toString = function() {
   var s = "SimpleMap: {";

   for(var i = 0; i < this.keys.length; i++) {
      var k = this.keys[i];
      s += k + "=" + this.values[k] + ", ";
   }

   if(this.keys.length > 0) {
      s = s.substring(0, s.length - 2);
   }

   return s + "}";
}

SimpleMap.prototype.writeBody = function() {
   var  s = "";

   for(var i = 0; i < this.keys.length; i++) {
      var k = this.keys[i];
      s += k + "=" + this.values[k] + "&";
   }

   return s;
}

SimpleMap.prototype.parseBody = function(ctnt) {
   if(ctnt == null || ctnt == "") {
      return;
   }

   var carr = ctnt.split("&");

   for(var i = 0; i < carr.length; i++) {
      var cstr = trim(carr[i]);

      if(cstr == "") {
         continue;
      }

      var eindex = cstr.indexOf("=");

      if(eindex < 0) {
         continue;
      }

      this.put(cstr.substring(0, eindex), cstr.substring(eindex + 1));
   }
}